package uilayer;
import modellayer.*;
import controllayer.*;
import java.util.Scanner;

/**
 * Write a description of class MainMenu here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class MainMenu
{
    private OrdreUI ordreUI;
    
    public MainMenu()
    {
        ordreUI = new OrdreUI();
    }

    /**
     * An example of a method - replace this comment with your own
     * 
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y 
     */
    public void start()
    {
        startMenu();
    }
    
    private void startMenu()
    {
        boolean exit = false;
        
        while(exit == false)
        {
            int choice = showMenuText();
            if(choice == 1)
            {
                startOrdreUI();
            }

            else if(choice == 2)
            {
                System.out.println("Det er desværre ikke muligt at oprette en kunde.");
            }

            else if(choice == 3)
            {
                System.out.println("Det er desværre ikke muligt at registrere en vare.");
            }

            else if(choice == 4)
            {
                exit = true;
            }
        }
    }
    
    private int showMenuText()
    {
        Scanner input = new Scanner(System.in);
        String menu = "";
        menu += "Velkommen\n";
        menu += "Hvad vil du arbejde med\n\n";
        menu += "1: Salg\n";
        menu += "2: Kunder\n";
        menu += "3: Varer\n";
        menu += "4: Exit\n";
        
        System.out.println(menu);
        int number = input.nextInt(); 
        return number;
    }
    
    private void startOrdreUI()
    {
        ordreUI.start();
    }
}
